/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.transformer.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;

import lombok.Getter;
import lombok.Setter;
import me.zhengjie.base.BaseEntity;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author RuitaoWei
* @date 2021-11-30
**/
@Entity
@Getter
@Setter
@Table(name="fds_data")
public class FdsData extends BaseEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "ID")
    private Integer id;

    @Column(name = "equip_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "变压器ID")
    private Integer equipId;

    @Column(name = "record_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "导入批次")
    private Integer recordId;

    @Column(name = "tan_delta",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "介质损耗因数")
    private String tanDelta;

    @Column(name = "e_real",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "复介电常数实部")
    private String eReal;

    @Column(name = "e_imaginary",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "复介电常数虚部")
    private String eImaginary;

    @Column(name = "c_real",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "复电容实部")
    private String cReal;

    @Column(name = "c_imaginary",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "复电容虚部")
    private String cImaginary;

    @Column(name = "frequency",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "频率")
    private String frequency;

    @Column(name = "power_factor",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "功率因数")
    private String powerFactor;

    public FdsData() {

    }

    public void copy(FdsData source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    public FdsData(Integer equipId, Integer recordId, String frequency, String powerFactor, String tanDelta, String eReal, String eImaginary, String cReal, String cImaginary) {
        this.equipId = equipId;
        this.recordId = recordId;
        this.frequency = frequency;
        this.powerFactor = powerFactor;
        this.tanDelta = tanDelta;
        this.eReal = eReal;
        this.eImaginary = eImaginary;
        this.cReal = cReal;
        this.cImaginary = cImaginary;
    }
}